{% extends "base_generic.html" %}

{% block content %}
<div class="container">
  <h2>图书列表</h2>
  {% for book in books %}
    <div class="card" style="display: flex; align-items: center; justify-content: space-between;">
      <div>
        <a href="{% url 'book-detail' book.pk %}" style="font-size: 1.1em; font-weight: bold;">{{ book.title }}</a>
        <span style="color: #888; margin-left: 10px;">作者：{{ book.author }}</span>
      </div>
      <div>
        <span style="color: #ff9800;">评分：{{ book.avg_score|floatformat:1 }}</span>
        <span style="margin-left: 10px;">👍 {{ book.likes.count }}</span>
      </div>
    </div>
  {% empty %}
    <div class="card">暂无书籍。</div>
  {% endfor %}
</div>
{% endblock %}
